package psi

import (
	"fmt"
	"strings"
)

/*
低电短信报警开关
平台发送:
[DW*YYYYYYYYYYYYYYY*LEN*LOWBAT,0 或 1]
实例:[DW*334588000000156*0008*LOWBAT,1]
终端回复:
11
[DW*YYYYYYYYYYYYYYY*LEN*LOWBAT]
实例:[DW*334588000000156*0006*LOWBAT]
说明: 设置产生低电报警后是否向中心号码发送短信(0:关闭,1:打开)
*/

type LOWBAT struct {
	Switch int // 0 或 1
}

func DealLOWBAT(method string, params map[string]interface{}) (string, error) {
	var lowbat LOWBAT
	err := MapToStruct(params, &lowbat)
	if err != nil {
		return "", err
	}
	var messageList []string
	messageList = append(messageList, "LOWBAT")
	messageList = append(messageList, fmt.Sprint(lowbat.Switch))
	message := strings.Join(messageList, ",")
	return message, nil
}
